package com.example.ythhome.login.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.ythhome.login.entity.User;
import com.example.ythhome.login.service.UserService;
import com.example.ythhome.login.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Administrator
* @description 针对表【t_user(用于系统账号登录注册)】的数据库操作Service实现
* @createDate 2025-05-07 20:35:27
*/
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User>
    implements UserService{
    @Autowired
    UserMapper userMapper;

    @Override
    public List<User> getAllUser() {
        return userMapper.getAll();
    }

    @Override
    public User getUser(int id) {
        return userMapper.getById(id);
    }

    @Override
    public User getByUserNo(String userno) {
        return userMapper.getByUserNo(userno);
    }

    @Override
    public User getByUserName(String userName) {
        return userMapper.getByUserName(userName);
    }

    @Override
    public boolean saveOneUser(User user) {
        return  userMapper.addUser(user);
    }

    @Override
    public boolean checkUserPassword(String accountName, String accountPwd) {
        return userMapper.checkUserPassword(accountName, accountPwd);
    }

}




